﻿<UserControl x:Class="HP.Cachalote.WPF.UserControls.TodoItemToolTipUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Skins/Converters.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid MinWidth="320" MinHeight="50" MaxWidth="650">
        <Grid.RowDefinitions>
            <!-- TodoItem Title -->
            <RowDefinition />
            <!-- TodoItem Note -->
            <RowDefinition />
            <!-- Separator -->
            <RowDefinition />
            <!-- Due Date -->
            <RowDefinition />
        </Grid.RowDefinitions>
        <TextBlock TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Padding="5" Background="DarkGray" Foreground="White" FontSize="15" FontWeight="Bold">
            <TextBlock.Style>
                <Style TargetType="{x:Type TextBlock}">
                    <Setter Property="Text">
                        <Setter.Value>
                            <MultiBinding StringFormat="{}[{0}] {1}">
                                <Binding Path="TodoLabelName" />
                                <Binding Path="Title"/>
                            </MultiBinding>
                        </Setter.Value>
                    </Setter>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding TodoLabelName}" Value="">
                            <Setter Property="Text" Value="{Binding Title}" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </TextBlock.Style>
        </TextBlock>
        <TextBlock Grid.Row="1" Padding="5" Text="{Binding Note}" FontSize="15" TextWrapping="Wrap">
            <TextBlock.Style>
                <Style TargetType="{x:Type TextBlock}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}" Value="">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </TextBlock.Style>
        </TextBlock>
        <Separator Margin="2" Grid.Row="2">
            <Separator.Style>
                <Style TargetType="{x:Type Separator}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Note}" Value="">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Separator.Style>
        </Separator>
        <TextBlock Grid.Row="3" Padding="5" Text="{Binding DueDate, Converter={StaticResource DueDateConverter}}" TextWrapping="Wrap">
            <TextBlock.Style>
                <Style TargetType="{x:Type TextBlock}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}" Value="">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </TextBlock.Style>
        </TextBlock>
    </Grid>
</UserControl>
